package com.k.kpp.dstest.webservice;

import com.k.kpp.dstest.dao.UserMapper;
import com.k.kpp.dstest.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class HelloServiceImpl implements HelloService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public String getStr(String cep) {
        return cep;
    }

    @Override
    public User getBean(String cep) {
        List<User> list = userMapper.selectListBean();
        return list.get(0);
    }

    @Override
    public Map<String, String> getMap(String cep) {
        //List<Map<String,Object>> list = userMapper.selectListMap();
        Map<String,String> itm = new HashMap<>();
        itm.put("name",cep);
        return itm;
    }

    @Override
    public List<User> getList(String cep) {
        List<User> list = userMapper.selectListBean();
        return list;
    }
}
